package com.expdatacloud.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.text.DecimalFormat;

/**
 * iqc来料周报
 *
 * @author jie
 * @date 2019/12/29 -16:59
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SuppliedMaterialsCheckWeekReportVo implements Serializable {

    private static final long serialVersionUID = 1L;
    /**
     * 送检批数
     */
    private int checkQty;
    /**
     * 合格批数
     */
    private int okQty;
    /**
     * 退货批数
     */
    private int salesReturnQty;
    /**
     * 批退货率目标<0.5%
     */
    private String standard;

    /**
     * 批退次率
     */
    private double lotRejectRate;

    public double getLotRejectRate() {
        if (salesReturnQty == 0 && checkQty == 0) {
            return 0;
        }
        float num = (float) salesReturnQty / checkQty;

        DecimalFormat df = new DecimalFormat("0.00");
        String format = df.format(num);
        return Double.parseDouble(format);
    }

    public void setLotRejectRate(double lotRejectRate) {
        this.lotRejectRate = lotRejectRate;
    }

    /**
     * 周
     */
    private int week;
    /**
     * 物料大类
     */
    private String udf8;

    /**
     * 合计
     */
    private int sumQty;
}
